{{template "header.html" .}}

<h1>Validation sample 2</h1>

{{if .errors}}
<div class="error">
	<h2>Oops, please correct these errors</h2>
</div>
{{end}}

<form action="/Sample2/HandleSubmit" method="POST">
	<fieldset>
		<legend>User informations</legend>

		<div class="field">
			<label for="username">Desired username :</label>
			<input id="username" name="username" value="{{.flash.username}}" class="{{errorClass "username" .}}"/>
			<span class="error">{{.errors.username}}</span>
		</div>

		<div class="field">
			<label for="firstname">First name :</label>
			<input id="firstname" name="firstname" size="30" value="{{.flash.firstname}}" class="{{errorClass "firstname" .}}"/>
			<span class="error">{{.errors.firstname}}</span>
		</div>

		<div class="field">
			<label for="lastname">Last name :</label>
			<input id="lastname" name="lastname" size="30" value="{{.flash.lastname}}" class="{{errorClass "lastname" .}}"/>
			<span class="error">{{.errors.lastname}}</span>
		</div>

		<div class="field">
			<label for="age">Age :</label>
			<input id="age" name="age" size="3" value="{{.flash.age}}" class="{{errorClass "age" .}}"/>
			<span class="error">{{.errors.age}}</span>
		</div>

	</fieldset>
	<fieldset>
		<legend>Password</legend>

		<div class="field">
			<label for="password">Password :</label>
			<input id="password" type="password" name="password" value="{{.flash.password}}" class="{{errorClass "password" .}}"/>
			<span class="error">{{.errors.password}}</span>
		</div>

		<div class="field">
			<label>Confirm password :</label>
			<input id="passwordConfirm" type="password" name="passwordConfirm" value="{{.flash.passwordConfirm}}" class="{{errorClass "passwordConfirm" .}}"/>
			<span class="error">{{.errors.passwordConfirm}}</span>
		</div>

	</fieldset>
	<fieldset>
		<legend>Email</legend>

		<div class="field">
			<label for="email">Email address :</label>
			<input id="email" name="email" size="30" value="{{.flash.email}}" class="{{errorClass "email" .}}"/></label>
			<span class="error">{{.errors.email}}</span>
		</div>

		<div class="field">
			<label for="emailConfirm">Confirm email address :</label>
			<input name="emailConfirm" size="30" value="{{.flash.emailConfirm}}" class="{{errorClass "emailConfirm" .}}"/>
			<span class="error">{{.errors.emailConfirm}}</span>
		</div>

	</fieldset>
	<fieldset>
		<legend>Conditions</legend>

		<div class="infos">
			Checking this box indicates that you accept terms of use.
			If you do not accept these terms, do not use this website :
		</div>

		<div class="field">
			<label for="termsOfUse">I accept terms of use :</label>
			<input id="termsOfUse" type="checkbox" value="true" name="termsOfUse" {{if .flash.termsOfUse}}checked="true"{{end}} class="{{errorClass "termsOfUse" .}}"/>
			<span class="error">{{.errors.termsOfUse}}</span>
		</div>

	</fieldset>

	<input type="submit" class="submit" value="Join !" />
</form>

{{template "footer.html" .}}
